﻿/****** Object:  Table [dbo].[BugNote]    Script Date: 08/18/2011 15:57:48 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[BugNote](
	[BugNotesId] [int] IDENTITY(1,1) NOT NULL,
	[BugId] [int] NOT NULL,
	[OwnerId] [int] NOT NULL,
	[Notes] [nvarchar](max) NOT NULL,
	[Stamp] [datetime] NOT NULL,
 CONSTRAINT [PK_BugNote] PRIMARY KEY CLUSTERED 
(
	[BugNotesId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[BugNote]  WITH CHECK ADD  CONSTRAINT [FK_BugNote_Bug] FOREIGN KEY([BugId])
REFERENCES [dbo].[Bug] ([BugId])
GO

ALTER TABLE [dbo].[BugNote] CHECK CONSTRAINT [FK_BugNote_Bug]
GO

ALTER TABLE [dbo].[BugNote]  WITH CHECK ADD  CONSTRAINT [FK_BugNote_User] FOREIGN KEY([OwnerId])
REFERENCES [dbo].[User] ([UserId])
GO

ALTER TABLE [dbo].[BugNote] CHECK CONSTRAINT [FK_BugNote_User]
GO

ALTER TABLE [dbo].[BugNote] ADD  CONSTRAINT [DF_BugNote_Stamp]  DEFAULT (getdate()) FOR [Stamp]
GO


